Optimal. Leaf size=72 \[ a \left (a^2-3 b^2\right ) x-\frac {b \left (3 a^2-b^2\right ) \log (\cos (c+d x))}{d}+\frac {2 a b^2 \tan (c+d x)}{d}+\frac {b (a+b \tan (c+d x))^2}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 72, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3563, 3606,
3556} \begin {gather*} -\frac {b \left (3 a^2-b^2\right ) \log (\cos (c+d x))}{d}+a x \left (a^2-3 b^2\right )+\frac {2 a b^2 \tan (c+d x)}{d}+\frac {b (a+b \tan (c+d x))^2}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3563
Rule 3606
Rubi steps
\begin {align*} \int (a+b \tan (c+d x))^3 \, dx &=\frac {b (a+b \tan (c+d x))^2}{2 d}+\int (a+b \tan (c+d x)) \left (a^2-b^2+2 a b \tan (c+d x)\right ) \, dx\\ &=a \left (a^2-3 b^2\right ) x+\frac {2 a b^2 \tan (c+d x)}{d}+\frac {b (a+b \tan (c+d x))^2}{2 d}+\left (b \left (3 a^2-b^2\right )\right ) \int \tan (c+d x) \, dx\\ &=a \left (a^2-3 b^2\right ) x-\frac {b \left (3 a^2-b^2\right ) \log (\cos (c+d x))}{d}+\frac {2 a b^2 \tan (c+d x)}{d}+\frac {b (a+b \tan (c+d x))^2}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.25, size = 79, normalized size = 1.10 \begin {gather*} \frac {(i a-b)^3 \log (i-\tan (c+d x))-(i a+b)^3 \log (i+\tan (c+d x))+6 a b^2 \tan (c+d x)+b^3 \tan ^2(c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.03, size = 74, normalized size = 1.03
method | result | size |
norman | \(\left (a^{3}-3 b^{2} a \right ) x +\frac {b^{3} \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {3 a \,b^{2} \tan \left (d x +c \right )}{d}+\frac {b \left (3 a^{2}-b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) | \(73\) |
derivativedivides | \(\frac {\frac {b^{3} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+3 b^{2} a \tan \left (d x +c \right )+\frac {\left (3 a^{2} b -b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (a^{3}-3 b^{2} a \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(74\) |
default | \(\frac {\frac {b^{3} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+3 b^{2} a \tan \left (d x +c \right )+\frac {\left (3 a^{2} b -b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (a^{3}-3 b^{2} a \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(74\) |
risch | \(3 i x b \,a^{2}-i b^{3} x +a^{3} x -3 a \,b^{2} x +\frac {6 i b \,a^{2} c}{d}-\frac {2 i b^{3} c}{d}+\frac {2 b^{2} \left (3 i a \,{\mathrm e}^{2 i \left (d x +c \right )}+b \,{\mathrm e}^{2 i \left (d x +c \right )}+3 i a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {3 b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) a^{2}}{d}+\frac {b^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) | \(140\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.52, size = 78, normalized size = 1.08 \begin {gather*} a^{3} x - \frac {3 \, {\left (d x + c - \tan \left (d x + c\right )\right )} a b^{2}}{d} - \frac {b^{3} {\left (\frac {1}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right )^{2} - 1\right )\right )}}{2 \, d} + \frac {3 \, a^{2} b \log \left (\sec \left (d x + c\right )\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.66, size = 71, normalized size = 0.99 \begin {gather*} \frac {b^{3} \tan \left (d x + c\right )^{2} + 6 \, a b^{2} \tan \left (d x + c\right ) + 2 \, {\left (a^{3} - 3 \, a b^{2}\right )} d x - {\left (3 \, a^{2} b - b^{3}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.09, size = 94, normalized size = 1.31 \begin {gather*} \begin {cases} a^{3} x + \frac {3 a^{2} b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 3 a b^{2} x + \frac {3 a b^{2} \tan {\left (c + d x \right )}}{d} - \frac {b^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {b^{3} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{3} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 603 vs.
\(2 (70) = 140\).
time = 0.80, size = 603, normalized size = 8.38 \begin {gather*} \frac {2 \, a^{3} d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 6 \, a b^{2} d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 3 \, a^{2} b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + b^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 4 \, a^{3} d x \tan \left (d x\right ) \tan \left (c\right ) + 12 \, a b^{2} d x \tan \left (d x\right ) \tan \left (c\right ) + b^{3} \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 6 \, a^{2} b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) - 2 \, b^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) - 6 \, a b^{2} \tan \left (d x\right )^{2} \tan \left (c\right ) - 6 \, a b^{2} \tan \left (d x\right ) \tan \left (c\right )^{2} + 2 \, a^{3} d x - 6 \, a b^{2} d x + b^{3} \tan \left (d x\right )^{2} + b^{3} \tan \left (c\right )^{2} - 3 \, a^{2} b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) + b^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) + 6 \, a b^{2} \tan \left (d x\right ) + 6 \, a b^{2} \tan \left (c\right ) + b^{3}}{2 \, {\left (d \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, d \tan \left (d x\right ) \tan \left (c\right ) + d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.82, size = 106, normalized size = 1.47 \begin {gather*} \frac {b^3\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d}+\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {3\,a^2\,b}{2}-\frac {b^3}{2}\right )}{d}+\frac {3\,a\,b^2\,\mathrm {tan}\left (c+d\,x\right )}{d}-\frac {a\,\mathrm {atan}\left (\frac {a\,\mathrm {tan}\left (c+d\,x\right )\,\left (a^2-3\,b^2\right )}{3\,a\,b^2-a^3}\right )\,\left (a^2-3\,b^2\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________